Framework (A-Z)

Reference for Wiring version 1.0 Build 0100+ If you have a previous version, use the reference included with your software. If see any errors or have any comments, let us know.

Name

splitString()

Examples
// the string to split
String str = String("1240,87000,10,30,20,1200");  
Vector < long > numVector;  // long Vector

void setup() {
  Serial.begin(9600); 
  pinMode(WLED, OUTPUT);
  // turn ON the wiring board LED
  digitalWrite(WLED, HIGH);

  // split str using ',' as separator and store the resolt on numVector
  splitString(str,',',numVector);  
  for (int i=0; i < numVector.size(); i++) { 
    // print the contents of numVector 
    Serial.println(numVector.get(i), DEC);
  }
}

void loop() {
  
}
Description Splits a string around matches of the given delimiter char and returns the result in a Vector. The string to split must be made in the format in the example: "numeric value 1'delim'numeric value 2'delim'...'delim'numeric value n".
Syntax
splitString(data, delim, result)
Parameters
data String: the string to split
delim char: the char used as delimiter
result Vector: vector of int or long numbers with the result
Returns none
Usage Application
Related String
Vector
Updated on July 07, 2011 11:09:01pm PDT

Creative Commons License